package org.dylan.evernote;

import java.util.List;

import org.apache.commons.lang3.ArrayUtils;

import com.evernote.edam.error.EDAMNotFoundException;
import com.evernote.edam.error.EDAMSystemException;
import com.evernote.edam.error.EDAMUserException;
import com.evernote.edam.type.Notebook;
import com.evernote.edam.type.Tag;
import com.evernote.thrift.TException;

/**
 * 
 * 
 * @Copyright: Copyright (c) 2013 FFCS All Rights Reserved
 * @Company: 北京福富软件有限公司
 * @author 陈作朋 Nov 1, 2013
 * @version 1.00.00
 * @history:
 * 
 */
public class ListTag {

	public static void main(String[] args) throws EDAMUserException, EDAMSystemException, TException, EDAMNotFoundException {
		EDAMContext context = new EDAMContext();

		List<Tag> tags = context.getNoteStore().listTags();
		System.out.println("size:" + tags.size());
		String rguid = "";
		for (Tag tag : tags) {
/*			if ("KeepNote".equals(tag.getName())) {
				System.out.println(tag);
				rguid = tag.getGuid();
			} else {
				if (tag.getParentGuid()!=null&&tag.getParentGuid().equals(rguid)) {
					System.out.println("  " + tag);
				}
			}*/
			String[] arr={"ZAKER","KeepNote"};
 			if(tag.getParentGuid()==null){
				if(!ArrayUtils.contains(arr,tag.getName())){
//					context.getNoteStore().expungeTag(tag.getGuid());
				    System.out.println("deltet:"+tag);
				}
			};
			
		}

	}
}
